#include "mkvstreamaudio.hpp"
#include "mkvcontext.hpp"
#include "ac3parser.hpp"

namespace MkvMux
{

class MkvStreamAudioAc3 : public MkvStreamAudio
{
    MkvStreamAudioAc3(const MkvStreamAudioAc3&);
    MkvStreamAudioAc3& operator=(const MkvStreamAudioAc3&);
    
protected:

    void WriteTrackName();
    void WriteTrackCodecID();
    void WriteTrackCodecName();

public:

    MkvStreamAudioAc3(MkvContext&, const BYTE*, ULONG);
    
    HRESULT Write(IMediaSample*);
    int EndOfStream();
    
private:

    Ac3Parser m_parser;

   class Frame : public MkvContext::AudioFrame
   {
      Frame& operator=(const Frame&);
      
   private:
      Ac3Parser::Frame* const m_pFrame;

   public:
      explicit Frame(Ac3Parser::Frame*);
      ~Frame();

      ULONG curr_timecode_ms() const;

      ULONG size() const;
      const BYTE* data() const;
      
   };
   
};

}  //end namespace MkvMux
